Value [...] not a valid choice, django-updown
Posted
by
tamara
on Stack Overflow
See other posts from Stack Overflow
or by tamara
Published on 2012-06-15T12:04:00Z
Indexed on
2012/06/21
9:16 UTC
Read the original article
Hit count: 122
I am trying to implemet django-updown https://github.com/weluse/django-updown. When I try to add vote trough the admin panel it says Value 1 not a valid choice.
This is the models.py from the application:
_SCORE_TYPE_CHOICES = (
('-1', 'DISLIKE'),
('1', 'LIKE'),
)
SCORE_TYPES = dict((value, key) for key, value in _SCORE_TYPE_CHOICES)
class Vote(models.Model):
content_type = models.ForeignKey(ContentType, related_name="updown_votes")
object_id = models.PositiveIntegerField()
key = models.CharField(max_length=32)
score = models.SmallIntegerField(choices=_SCORE_TYPE_CHOICES)
user = models.ForeignKey(User, blank=True, null=True, related_name="updown_votes")
ip_address = models.IPAddressField()
date_added = models.DateTimeField(default=datetime.datetime.now, editable=False)
date_changed = models.DateTimeField(default=datetime.datetime.now, editable=False)
Do you have an idea what could be wrong?
© Stack Overflow or respective owner